x86/shadow: hold references for the duration of emulated writes
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 20 Jun 2017 12:36:11 +0000 (14:36 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 Jun 2017 12:36:11 +0000 (14:36 +0200)
commit26217aff67ae1538d4e1b2226afab6993cdbe772
tree25be10431f603c720e2a45a23a31f7c0b76e79cb
parent4b78efa91c8ae3c42e14b8eaeaad773c5eb3b71a
x86/shadow: hold references for the duration of emulated writes

The (misnamed) emulate_gva_to_mfn() function translates a linear address to an
mfn, but releases its page reference before returning the mfn to its caller.

sh_emulate_map_dest() uses the results of one or two translations to construct
a virtual mapping to the underlying frames, completes an emulated
write/cmpxchg, then unmaps the virtual mappings.

The page references need holding until the mappings are unmapped, or the
frames can change ownership before the writes occurs.

This is XSA-219.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/shadow/common.c